package com.brand.prisd.ViewHolder;

import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.brand.prisd.R;
import com.brand.prisd.activity.AllDevicesActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by HJ on 2018/12/11.
 */
public class Type4ViewHolder extends RecyclerView.ViewHolder  {
    @BindView(R.id.ll_ZigBee)
    LinearLayout llZigBee;
    @BindView(R.id.ll_bluetooth)
    LinearLayout llBluetooth;
    @BindView(R.id.ll_allDevices)
    LinearLayout llAllDevices;
    private Context context;

    public Type4ViewHolder(@NonNull View itemView) {
        super(itemView);
        context = itemView.getContext();
        ButterKnife.bind(this,itemView);

    }

    @OnClick({R.id.ll_ZigBee, R.id.ll_bluetooth, R.id.ll_allDevices})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ll_ZigBee:
                Toast.makeText(context, "待开发...", Toast.LENGTH_SHORT).show();
                break;
            case R.id.ll_bluetooth:
                Snackbar.make(view,"待开发...",Toast.LENGTH_SHORT).show();
                break;
            case R.id.ll_allDevices:
                go2AllDevicesActivity();
                break;
        }
    }
    private void go2AllDevicesActivity() {
        Intent intent = new Intent(context, AllDevicesActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

}
